var g_ClientConfig = {
    server:'http://localhost:8000',
    /* background、foreground、card name*/
    cards : {
        "attack" :{
            imgs:["res/card/Card_11-1.bmp","res/card/Card_59-1.bmp","res/card/Card_193-1.bmp"],
        },
        "iron-force":{
            imgs:["res/card/Card_12-1.bmp","res/card/Card_61-1.bmp","res/card/Card_165-1.bmp"],
        } ,
        "blade-master":{
            imgs:["res/card/Card_28-1.bmp","res/card/Card_75-1.bmp","res/card/Card_186-1.bmp"],
        } ,
    } ,
    animations: {
        player_stand_1:{
            filename:"res/action/sbgrp2_2-1.png",
            width:220,
            height:224,
            frame_number:5,
            duration:0.5
        },
        player_stand_shadow_1:{
            filename:"res/action/sbgrp2_44-1.png",
            width:220,
            height:88,
            frame_number:5,
            duration:0.5
        },
        player_fight_1:{
            filename:"res/action/sbgrp2_6-1.png",
            width:220,
            height:224,
            frame_number:4,
            duration:0.4,
        },
        player_fight_shadow_1:{
            filename:"res/action/sbgrp2_48-1.png",
            width:220,
            height:88,
            frame_number:4,
            duration:0.4,
        },
        player_move_1:{
            filename:"res/action/sbgrp2_5-1.png",
            width:220,
            height:224,
            frame_number:4,
            duration:0.4,
        },
        player_move_shadow_1:{
            filename:"res/action/sbgrp2_47-1.png",
            width:220,
            height:88,
            frame_number:4,
            duration:0.4,
        },
        player_damaged_1:{
            filename:"res/action/sbgrp2_8-1.png",
            width:220,
            height:224,
            frame_number:4,
            duration:0.4,
        },
        player_damaged_shadow_1:{
            filename:"res/action/sbgrp2_50-1.png",
            width:220,
            height:88,
            frame_number:4,
            duration:0.4,
        },
        player_defense_1:{
            filename:"res/action/sbgrp2_9-1.png",
            width:220,
            height:224,
            frame_number:3,
            duration:0.3,
        },
        player_defense_shadow_1:{
            filename:"res/action/sbgrp3_79-1.png",
            width:200,
            height:84,
            frame_number:3,
            duration:0.3,
        },
        enemy_stand_1:{
            filename:"res/action/sbgrp3_16-1.png",
            width:216,
            height:212,
            frame_number:5,
            duration:0.5
        },
        enemy_stand_shadow_1:{
            filename:"res/action/sbgrp3_58-1.png",
            width:200,
            height:84,
            frame_number:5,
            duration:0.5
        },
        enemy_move_1:{
            filename:"res/action/sbgrp3_19-1.png",
            width:216,
            height:212,
            frame_number:4,
            duration:0.4
        },
        enemy_move_shadow_1:{
            filename:"res/action/sbgrp3_61-1.png",
            width:200,
            height:84,
            frame_number:4,
            duration:0.4,
        },
        enemy_fight_1:{
            filename:"res/action/sbgrp3_20-1.png",
            width:216,
            height:212,
            frame_number:4,
            duration:0.4
        },
        enemy_fight_shadow_1:{
            filename:"res/action/sbgrp3_63-1.png",
            width:200,
            height:84,
            frame_number:4,
            duration:0.4,
        },
        enemy_damaged_1:{
            filename:"res/action/sbgrp3_22-1.png",
            width:216,
            height:212,
            frame_number:4,
            duration:0.4
        },
        enemy_damaged_shadow_1:{
            filename:"res/action/sbgrp3_64-1.png",
            width:200,
            height:84,
            frame_number:4,
            duration:0.4,
        },
        enemy_defense_1:{
            filename:"res/action/sbgrp3_23-1.png",
            width:216,
            height:212,
            frame_number:3,
            duration:0.3
        },
        enemy_defense_shadow_1:{
            filename:"res/action/sbgrp3_74-1.png",
            width:200,
            height:84,
            frame_number:3,
            duration:0.3,
        },
        damage_effect:{
            filename:"res/action/sbgrp4_3-1.png",
            width:88,
            height:88,
            frame_number:4,
            duration:0.2
        },
        draw_effect:{
            filename:"res/action/sbgrp4_15-1.png",
            width:140,
            height:204,
            frame_number:3,
            duration:0.2
        },
        //town anaimation
        human_walk_1:{
            filename:"res/town/human/Kyoten_43-1.png",
            width:28,
            height:28,
            frame_number:6,
            duration:6,
        },
        human_stand_1:{
            filename:"res/town/human/Kyoten_36-1.png",
            width: 30,
            height: 22,
            frame_number:6,
            duration:3,
        },
        human_stand_2:{
            filename:"res/town/human/Kyoten_37-1.png",
            width: 24,
            height: 22,
            frame_number:6,
            duration:3,
        },
        human_stand_3:{
            filename:"res/town/human/Kyoten_38-1.png",
            width: 30,
            height: 22,
            frame_number:6,
            duration:3,
        },
        human_stand_4:{
            filename:"res/town/human/Kyoten_39-1.png",
            width: 20,
            height: 22,
            frame_number:12,
            duration:6,
        }
    },
    town:{
        qingzhou:{
            background:"res/town/background/Town_14-1.png",
            frame:"res/town/frame/TownFram_5-1.png",
            frame_castle:"res/town/frame/TownFram_22-1.png",
            wushuguan:"res/town/building/Kyoten_152-1.png",
            wushuguan_mask:"res/town/building/Kyoten_153-1.png",
            wushuguan_position:[65,128],
            stand_human:[
                {
                    animation:"human_stand_1",
                    position:[150,135]
                },
                {
                    animation:"human_stand_2",
                    position:[270,180]
                },
                {
                    animation:"human_stand_3",
                    position:[290,150]
                },
                {
                    animation:"human_stand_3",
                    position:[290,150]
                },
                {
                    animation:"human_stand_4",
                    position:[350,55]
                },
             ],
        }
    }
}

function loadRes() {
    var res = [];
    for(var k in g_ClientConfig.cards){
        if(g_ClientConfig.cards.hasOwnProperty(k)){
            var card = g_ClientConfig.cards[k];
            res.push({src:card.imgs[0]});
            res.push({src:card.imgs[1]});
            res.push({src:card.imgs[2]});
        }
    }
    for(var k in g_ClientConfig.animations){
        if(g_ClientConfig.animations.hasOwnProperty(k)){
            var animation = g_ClientConfig.animations[k];
            res.push({src:animation.filename});
        }
    }
    for(var k in g_ClientConfig.town){
        if(g_ClientConfig.town.hasOwnProperty(k)){
            var town = g_ClientConfig.town[k];
            res.push({src:town.background});
            res.push({src:town.frame});
            res.push({src:town.frame_castle});
            res.push({src:town.wushuguan});
            res.push({src:town.wushuguan_mask});
        }
    }
    return res;
}